//
//  DateViewController.m
//  XWZ_News_Work
//
//  Created by penngshi on 16/1/15.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "DateViewController.h"
#import <MBProgressHUD.h>
#define Kheight [[UIScreen mainScreen]bounds].size.height / 667
@interface DateViewController ()<UIWebViewDelegate>
@property(nonatomic, retain) UIWebView *webView;
@property(nonatomic, retain) MBProgressHUD *loadingHUD;
@end

@implementation DateViewController
- (void)viewWillAppear:(BOOL)animated {
    
    self.navigationController.navigationBar.hidden = NO;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor redColor];
    self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(backToHomePage:)];
    
    self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    
    self.loadingHUD = [MBProgressHUD showHUDAddedTo:self.webView animated:YES];
    self.loadingHUD.labelText = @"正在加载";
    self.loadingHUD.labelFont = [UIFont systemFontOfSize:17 * Kheight];
    [self.loadingHUD show:YES];
    // 自动适应屏幕
    self.webView.scalesPageToFit = YES;
    // 边界不回弹
    self.webView.scrollView.bounces = NO;
    // 隐藏滑动线
    self.webView.delegate = self;
    
    self.webView.scrollView.showsVerticalScrollIndicator = NO;
    NSString *url = @"http://v.tmiaoo.com/ck/nba.php";
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
    [self.view addSubview:self.webView];
    [self.webView loadRequest:request];
}
- (void)backToHomePage:(UIBarButtonItem *)barButtonItem
{
    self.tabBarController.tabBar.hidden = NO;
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [self.loadingHUD hide:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
